<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>margin</title>
  <style>
    .box{
      width: 400px;
      height: 500px;
      background-color: red;
      margin: 0 auto;
      box-sizing: border-box;
    }
    .contener {
      width: 200px;
      height: 200px;
      background-color: yellowgreen;
      margin-left: auto;
      margin-right: auto;
    }
  </style>
</head>
<body>
  <div class="box">
    <div class="contener"></div>
  </div>
</body>
</html>